#include <iostream>

using std::cout;
using std::endl;

int func(int x, int y)
{
    cout << "int func(int, int)" << endl;
    return x + y;
}
class Example
{
public:
    //int(int, int)
    int add(int x, int y)
    {
        cout << "int add(int, int)" << endl;
        return x + y;
    }
};

void test()
{
    int (*pFunc)(int, int);
    //C语言中的函数指针
    /* pFunc = &Example::add;//error */
    pFunc = func;

    cout << endl;
    //成员函数指针
    int (Example::*pFuncMen)(int, int);
    pFuncMen = &Example::add;
}

int main(int argc, char *argv[])
{
    test();
    return 0;
}

